{% extends "base.html" %}

{% load crispy_forms_tags %}

{% block main %}
    <div class="col-md-8">
        <div class="card">
            <div class="card-header"><a href="{% url 'forum:index' %}">django forum demo</a> > <span>注册</span></div>
            <div class="card-block">
                {% crispy form %}
            </div>
        </div>
    </div>
    <div class="col-md-4">
        <div class="card">
            <div class="card-header">其他登录方式</div>
            <div class="card-block">
                <p class="card-text">第三方登录功能正在开发中...</p>
            </div>
        </div>
    </div>
{% endblock main %}

{% block script %}
    <script>
        $('#div_id_captcha').find('img').first().on('click', function () {
            var $form = $(this).parents('form');

            $.getJSON('/captcha/refresh/', {}, function (json) {
                $form.find('input[name="captcha_0"]').val(json.key);
                $form.find('img.captcha').attr('src', json.image_url);
            });

            return false;
        });
    </script>
{% endblock script %}